package TankGame05;

import java.util.Vector;

public class MyTank extends Tank {
    public Bullet bullet = null;
    public Vector<Bullet> bulletVector = new Vector<>();//用来保存多发子弹
//    private boolean isLive = true;
    public MyTank(int x, int y) {
        super(x, y);
    }
    public void shotEnemy(){
        if(bulletVector.size() == 5) {
            return;//控制子弹个数
        }
        switch (getDirect()){
            case 0:
                bullet = new Bullet(getX()+20,getY(),0);

                break;
            case 1:
                bullet = new Bullet(getX()+60,getY()+20,1);

                break;
            case 2:
                bullet = new Bullet(getX()+20,getY()+60,2);

                break;
            case 3:
                bullet = new Bullet(getX(),getY()+20,3);

                break;
        }
        bulletVector.add(bullet);//把单颗子弹加入子弹集合中
        bullet.start();//调用该线程类的run方法
    }

//    public boolean getIsLive() {
//        return isLive;
//    }
//
//    public void setIsLive(boolean live) {
//        isLive = live;
//    }
}
